/*
 * @Author: zcy
 * @Date: 2025-02-17 10:20:28
 * @LastEditTime: 2025-02-17 17:13:30
 * @LastEditors: zcy
 * @FilePath: \my-vue-app\vite.config.js
 * @Description:
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import removeConsole from "vite-plugin-remove-console";
import path from "path";

// https://vite.dev/config/
export default defineConfig({
  base: process.env.NODE_ENV === "production" ? "/pokemon" : "/",
  build: {
    outDir: "pokemon",
    minify: "esBuild",
    target: "es2015",
  },
  plugins: [
    vue(),
    removeConsole({
      // 配置选项可以选择移除的 console 类型
      // 例如：removeAll: true 会移除所有 console
      // 你可以移除指定类型例如：console.warn、console.error 等
      removeAll: true, // 可选参数，默认为 false
    }),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"), // 将 @/ 映射到 src/ 目录
      "@assets": path.resolve(__dirname, "src/assets"), // 将 @assets/ 映射到 src/assets/ 目录
      "@components": path.resolve(__dirname, "src/components"), // 将 @components/ 映射到 src/components/ 目录
    },
  },
});
